**replication Stata do file for Chen, Tse-hsin ""(2024) 
/* Important notice
Firstly, in order to use brant command in Stata, you need to install SPost13 package by J. Scott Long & Jeremy Freese. The website is as follows:
https://jslsoc.sitehost.iu.edu/spost13.htm

Secondly, to estimate partial proportional odds model, you need to install gologit2 package by Richard Williams. The website is as follows:
https://www3.nd.edu/~rwilliam/gologit2/
 */

set more off
capture log close _all
* change this to the appropriate path in your computer
cd "D:\MEGA\ABS\ABS_Data\output1\replication\"

* output file
log using model, replace text name(replication)

//  Round 1 - loading the R1 data
use "ABS_Taiwan_6waves.dta", clear

* keep only Round 1 cases - year 2001
preserve
keep if waves == 1

* parallel ordinal logit for round 1
ologit tr_mtary scapital intertr trad satdemo govttp govtrust ///
urban male age educ income intpoli
brant, detail

* generalized ordinal logit for table 2
gologit2 tr_mtary scapital intertr trad govtrust satdemo govttp ///
urban male age educ income intpoli, npl(scapital male)

*joint test of H1
test scapital intertr

*joint test of H4
test satdemo govttp

* restore dataset to all waves
restore

* keep only Round 2 cases - year 2006
preserve
keep if waves == 2

* parallel ordinal logit for round 2
ologit tr_mtary scapital intertr trad satdemo govttp govtrust ///
urban male age educ income intpoli
brant, detail

* generalized ordinal logit for table 3
gologit2 tr_mtary scapital intertr trad govtrust satdemo govttp ///
urban male age educ income intpoli, npl(satdemo urban male educ)

*joint test of H1
test scapital intertr

*joint test of H4
test satdemo govttp

* restore dataset to all waves
restore

* keep only Round 3 cases - year 2010
preserve
keep if waves == 3

* parallel ordinal logit for round 3
ologit tr_mtary scapital intertr trad satdemo govttp govtrust ///
urban male age educ income intpoli
brant, detail

* generalized ordinal logit for table 4
gologit2 tr_mtary scapital intertr trad govtrust satdemo govttp ///
urban male age educ income intpoli, npl(male age educ)

*joint test of H1
test scapital intertr

*joint test of H4
test satdemo govttp

* restore dataset to all waves
restore

* keep only Round 4 cases - year 2014
preserve
keep if waves == 4

* parallel ordinal logit for round 4
ologit tr_mtary scapital intertr trad satdemo govttp govtrust ///
urban male age educ income intpoli
brant, detail

* generalized ordinal logit for table 5
gologit2 tr_mtary scapital intertr trad govtrust satdemo govttp ///
urban male age educ income intpoli, npl(satdemo)

*joint test of H1
test scapital intertr

*joint test of H4
test satdemo govttp

* restore dataset to all waves
restore

* keep only Round 5 cases - year 2018
preserve
keep if waves == 5

* parallel ordinal logit for round 5
ologit tr_mtary scapital intertr trad satdemo govttp govtrust ///
urban male age educ income intpoli
brant, detail

* generalized ordinal logit for table 6
gologit2 tr_mtary scapital intertr trad govtrust satdemo govttp ///
urban male age educ income intpoli, npl(intertr govtrust male)

*joint test of H1
test scapital intertr

*joint test of H4
test satdemo govttp

* restore dataset to all waves
restore

* keep only Round 6 cases - year 2022
preserve
keep if waves == 6

* parallel ordinal logit for round 6
ologit tr_mtary scapital intertr trad satdemo govttp govtrust ///
urban male age educ income intpoli
brant, detail

* generalized ordinal logit for table 7
gologit2 tr_mtary scapital intertr trad govtrust satdemo govttp ///
urban male age educ income intpoli, npl(age educ)

*joint test of H1
test scapital intertr

*joint test of H4
test satdemo govttp

* restore dataset to all waves
restore

// pooled 6 rounds of datasets - use all cases

* parallel ordinal logit of all 6 rounds with waves dummies
ologit tr_mtary scapital intertr trad satdemo govttp govtrust ///
urban male age educ income intpoli i.waves
brant, detail

*npl(govtrust male age educ)

* generalized ordinal logit of all 6 rounds with waves dummies for table 8
gologit2 tr_mtary scapital intertr trad satdemo govttp govtrust ///
urban male age educ income intpoli i.waves, npl(govtrust male age educ)

//  closing the log
log close _all